<template>
	<div id="app">
		<div style="height: 20px;display:flex;align-items: center;">
			<span style="height: 20px;line-height: 20px;font-size: 20px;margin-bottom: 20px;">查看所有用户信息</span>
		</div>
		<template>
			<el-table :data="tableData" border style="width: 100%">
				<el-table-column fixed label="序号" type="index" width="50">
				</el-table-column>
				<el-table-column prop="userId" label="用户ID" width="120">
				</el-table-column>
				<el-table-column prop="imageUrl" label="头像" width="200">
					<template slot-scope="scope" v-if="scope.row.imageUrl">
						<el-image style="width: 100px; height: 100px"
							:src="require('@/assets/touxiang/'+scope.row.imageUrl)"
							:preview-src-list="[require('@/assets/touxiang/'+scope.row.imageUrl)]" />
					</template>
				</el-table-column>
				<el-table-column prop="userName" label="用户名称" width="180">
				</el-table-column>
				<el-table-column prop="userSex" label="用户性别" width="60">
				</el-table-column>
				<el-table-column prop="userPhone" label="用户手机号" width="200">
				</el-table-column>
				<el-table-column prop="userBirthdate" label="用户出生日期" width="180">
				</el-table-column>
				<el-table-column prop="userLocation" label="用户地址" width="180">
				</el-table-column>
				<el-table-column fixed="right" prop="userCreatetime" label="用户创建时间" width="180" sortable>
					<template slot-scope="scope">
						<div>
							<div>{{ scope.row.userCreatetime | formatDate }}</div>
						</div>
					</template>
				</el-table-column>
			</el-table>
		</template>
	</div>
</template>

<script>
	import request from '@/utils/axios/request.js'
	export default {
		inject: ['reload'],
		data() {
			return {
				token: '',
				tableData: [{
					userId: '',
					imageUrl: '',
					userName: '',
					userSex: '',
					userPhone: '',
					userBirthdate: '',
					userLocation: '',
					userCreatetime: ''
				}]
			}
		},
		methods: {

		},
		created() {
			// this.t = this.$cookies.get("token")
			// console.log(this.token)
			console.log(this.src)
			request({
					method: 'get',
					url: '/userInfo/findAllUserInfo',
					// headers: {
					// 	token: this.t
					// }
				})
				.then((res) => {
					console.log(res)
					var jsonObj = JSON.parse(JSON.stringify(res.data.data));
					this.tableData = jsonObj;
					// console.log(jsonObj)
				})
		}
	}
</script>

<style scoped>
	::v-deep.el-image-viewer__img {

	}
</style>